package org.mcjug.locationmailer.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class NetworkConnectivity {
	 public static boolean isAvailable(Context context) {
		 ConnectivityManager connMgr = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
		 
		 // Get the first network interface that is available
		 NetworkInfo activeNetworkInfo = connMgr.getActiveNetworkInfo();
		 
		 // If null is returned then there is no Internet connection available
		 return activeNetworkInfo != null && activeNetworkInfo.isAvailable();
	 }	 
}
